<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport"
    content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
  <meta name="author" content="火星科技 http://mars3d.cn " />
  <meta name="apple-touch-fullscreen" content="yes" />
  <meta name="apple-mobile-web-app-capable" content="yes" />
  <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  <meta name="format-detection" content="telephone=no" />
  <meta name="x5-fullscreen" content="true" />
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
  <!-- 标题及搜索关键字 -->
  <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
  <meta
    name="description"
    content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS" />

  <link rel="shortcut icon" type="image/x-icon" href="/img/favicon/favicon.ico" />
  <title>风向图 | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

  <!--第三方lib-->
  <script
    type="text/javascript"
    src="/lib/include-lib.js"
    libpath="/lib/"
    include="jquery,layer,toastr,font-awesome,bootstrap,layer,haoutil,mars3d,mars3d-wind"></script>

  <!--左上角面板gui-->
  <script src="/lib/datgui/dat.gui.min.js"></script>

  <link href="/css/style.css" rel="stylesheet" />
  <style>
    .control {
      position: absolute;
      top: 75px;
      right: 15px;
    }
  </style>
</head>

<body class="dark">
  <div id="mars3dContainer" class="mars3d-container"></div>

  <!-- 面板 -->
  <div class="infoview">
    <div>
      <button id="btnGetCenter" class="btn btn-primary" onclick="loadHongkongData()">香港</button>
      <button id="btnGetCenter" class="btn btn-primary" onclick="loadDongnanData1()">新加坡</button>
      <button id="btnGetCenter" class="btn btn-primary" onclick="loadDongnanData2()">洋流</button>
      <button id="btnGetCenter" class="btn btn-primary" onclick="loadEarthData()">全球</button>
    </div>
  </div>
  <div class="control"></div>

  <script src="/js/common.js"></script>
  <script src="./map.js"></script>

  <script type="text/javascript">
    "use script" //开发环境建议开启严格模式

    let windLayerObj // gui的面板数据，与windLayer数据相同
    function initUI(options) {
      let minLineWidth = 1
      let maxLineWidth = 5

      let minLineLength = 20
      let maxLineLength = 100
      windLayerObj = {
        particlesNumber: 100, // 粒子总数
        minLineWidth: 1, // 轨迹宽度
        maxLineWidth: 5,
        minLineLength: 20, // 轨迹长度
        maxLineLength: 100,
        speedFactor: 0.5, // 速度系数
        dropRate: 0.003, // 粒子消失率
        dropRateBump: 0.01, // 额外消失率
        flipY: false, // 翻转Y坐标

        lineColor: "#FF0000",
        fixedHeight: 1.0,
        fadeOpacity: 0.996
      }

      // eslint-disable-next-line no-undef
      let gui = new dat.GUI({
        autoPlace: false
      })
      // 根据windLayerObj整体修改，也可以单个数据修改
      gui.add(windLayerObj, "particlesNumber", 1, 1000, 1).onFinishChange((e) => setLayerOptions({ particlesTextureSize: e }))
      gui.add(windLayerObj, "minLineWidth", 1, 10, 0.1).onFinishChange((e) => {
        minLineWidth = e
        setLayerOptions({ lineWidth: { min: e, max: maxLineWidth } })
      })
      gui.add(windLayerObj, "maxLineWidth", 1, 10, 0.1).onFinishChange((e) => {
        maxLineWidth = e
        setLayerOptions({ lineWidth: { min: minLineWidth, max: e } })
      })
      gui.add(windLayerObj, "minLineLength", 1, 200, 1).onFinishChange((e) => {
        minLineLength = e
        setLayerOptions({ lineWidth: { min: e, max: maxLineWidth } })
      })
      gui.add(windLayerObj, "maxLineLength", 1, 200, 1).onFinishChange((e) => {
        maxLineLength = e
        setLayerOptions({ lineWidth: { min: minLineWidth, max: e } })
      })
      gui.add(windLayerObj, "speedFactor", 0.1, 20, 0.1).onFinishChange((e) => setLayerOptions({ speedFactor: e }))

      gui.add(windLayerObj, "dropRate", 0.0001, 0.01, 0.0001).onFinishChange((e) => setLayerOptions({ dropRate: e }))
      gui.add(windLayerObj, "dropRateBump", 0, 0.2, 0.001).onFinishChange((e) => setLayerOptions({ dropRateBump: e }))
      gui.add(windLayerObj, "flipY").onChange((value) => setLayerOptions({ flipY: value }))
      gui.addColor(windLayerObj, "lineColor").onFinishChange((color) => setLayerOptions({ colors: [color] }))

      gui.domElement.classList.add("control")
      document.body.appendChild(gui.domElement)
    }
  </script>
</body>

</html>
